clear; clc;
% fun = @(x) x.*x.*sin(x.*x + 3*x - 4);
% 
% ret1 = Derivation(fun,1.3,0.001);
% ret2 = Derivation(fun,1.5,0.001);
% ret3 = TowDerivation(fun,1.4,0.01);
% fprintf("%d   %d   %d",ret1,ret2,ret3);


% fun = inline('5400*v./(8.276*(v.*v)+2000)','v');
% ret1 = quadl(fun,15,30);
% 
% fun=inline('5400*v./(8.276*v.^2+2000)','v');
% fun =@(v)5400*v./(8.276*v.^2+2000);
% ret2 = quadl(fun,15,30);
% 
% fprintf("%d",ret1 - ret2);
% fun = @(x)5.*x;
% quadl(fun,0,1)
% 
% fun = @(o)0.75*1.*sin(o).*cos(o);
% 
% ret = quadl(fun,0,pi/2) * 4
% 
% clear; x=-3/4:0.0001:3/4;
% 
% y=2.*sqrt(1-16/9.*x.^2); 
% 
% P=trapz(x,y) 
% 
% tmp = 3/4*pi



% fun = @(x,y) x + y; 
% 
% 
% [x,y] = ode45(fun,[0,1,2,3],1);
% fun = @(x,y)[2*x +3*y;2*x + y];



% fun = @(t, y) [-2*y(1) - 3*y(2); 2*y(1) + y(2)];


% fun = @(t, x,y) [-2*x - 3*y; 2*x + y];
% [xx,yy] = ode45(@(t,Y)fun(t,Y(1),Y(2)),[0,10],[-2.7,2.8]);
% 
% fun =@(t,y,dy) [dy;0.01*dy.*dy + sin(t) - 2*y];
% 
% [t,x] = ode45(@(t,Y)fun(t,Y(1),Y(2)) ,[0,5],[0,1]);
% plot(t,x(:,1));
% pause;
% x(end,1);
% plot(t,x(:,1));


% fun=@(t,x)[x(2);0.01*x(2)^2-2*x(1)+sin(t)];%fun表示两个方程的右端，注意第一个x(2)表示x(1)的导函数。
% 
% [t,x]=ode45(fun,[0 5],[0;1]);x(end,1)
% 
% plot(t,x(:,1))
% % y0 = [1; 0.5];  % 初始值 [y1; y2]
% 定义时间跨度
% tspan = [0 10];  % 从 0 到 10 秒
% 
% % 定义匿名函数
% fun = @(t, y) [-2*y(1) - 3*y(2); 2*y(1) + y(2)];
% 
% % 调用求解器
% [t, y] = ode45(fun, [0,10],[-2.7;2.8]);

fun = @(x,y)2*x + y.*y;
[x,y] = ode45(fun,[0,1.58],0);

plot(x,y);














